<template>
  <div>
    <a>
      <table class="data_table">
        <tr class="line">
            <th  v-for="title in cols" :key="title.index">{{title.value}}</th>
        </tr>
        <tr v-for="col in tableData" :key="col.index">
            <td v-for="cl in col" :key="cl.index" :style="cl.color">{{ cl.value }}<img :src="cl.src" alt=""></td>
        </tr>
      </table>
    </a>
  </div>
</template>

<script>
export default {
  props: {
    cols: {
      default: ''
    },
    tableData: {
      default: ''
    }
  },
  methods: {
    onClick: function (str) {
      this.$emit(str)
    },
    showDetail: function () {
      var ipcRenderer = window.require('electron').ipcRenderer
      ipcRenderer.send('switch-page', '#/ranking')
    }
  }
}
</script>

<style scoped>
table tr {
  line-height: 50px;
}
table tr:hover{
  background-color:#cfe4f8;
}
table tr td:first-child{
  text-align: left;
  padding-left: 20px;
  line-height: 20px;
}
table tr>td img{
  margin-right: -28px;
  margin-left: 8px;
  margin-top: -15px;
  width: 20px;
}
  .data_table{
    width:100%;text-align: center;background-color: #fff;border-radius: 5px;
  }
  .line{
    border:1px solid #ddd;
  }
</style>
